package net.greyar.theory;

public class Constraint {
	private String string;
	private Symbol one;
	private Symbol two;
	public Constraint(Symbol one, Symbol two) {
		this.one = one;
		this.two = two;
		toString(new StringBuilder());
	}
	public Symbol getOne() {
		return one;
	}
	public Symbol getTwo() {
		return two;
	}
	public Substitution satisfy(Substitution sigma) {
		return one.unify(two, sigma);
	}
	@Override
	public String toString() {
		return string;
	}
	public StringBuilder toString(StringBuilder sb) {
		int start = sb.length();
		one.toString(sb);
		sb.append(":");
		two.toString(sb);
		string = sb.substring(start);
		return sb;
	}
}
